import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int count = 0;
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        char c = 'b';
        for (int i = 0;i < s.length();i++){
            char a = s.charAt(i);
            if(a == c){
                count++;
            }
        }
        System.out.println(count);
    }



    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        StringBuffer stringBuffer = new StringBuffer(a);
        System.out.println(stringBuffer.reverse());
    }



    public static void main4(String[] args) {
        int a = 5;
        if(a < 0){
            System.out.println("erro");
        }
        if(a == 0){
            System.out.println(1);
        }else{
            long febo = 1;
            for (int i = 1; i <= a; i++) {
                febo = febo * i;
            }
            System.out.println(febo);
        }
    }


    public static void main3(String[] args) {
        int a = 20;
        int b = 40;
        int c = 30;
        int max = 0;
        max = a > b ? a : b;
        max = c > max ? c : max;
        System.out.println(max);
    }



    public static void main2(String[] args) {
        int a = 25;
        a = 2*a + 5;
        int b = 30;
        b = 2*b;
        System.out.println(a == b);
    }


    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a  = scanner.nextLine();
        String b = a.substring(0,3) + "****" + a.substring(7,11);
        System.out.println(b);
    }
}
